package com.imooc.service.ServiceImple;

import com.imooc.dataobject.ProductInfo;
import com.imooc.common.ProductStats;
import com.imooc.repository.ProductInfoRepository;
import com.imooc.service.ProductInfoService;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * class_name: com.imooc.service.ServiceImple
 * <p>
 * describe: TODO
 * creat_user: ErPengHe
 * creat_date: 2018/1/16
 * creat_time: 23:36
 **/
@Service
public class ProductInfoServiceImpl implements ProductInfoService{

private ProductInfoRepository productInfoRepository;

    @Override
    public List<ProductInfo> findAllUp() {
        return productInfoRepository.findByProductStatus(ProductStats.UP.getCode());
    }

    @Override
    public Page<ProductInfo> findAll(Pageable pageable) {
        return productInfoRepository.findAll(pageable);
    }

    @Override
    public ProductInfo save(ProductInfo productInfo) {
        return productInfoRepository.save(productInfo);
    }
}
